/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package adsreis.com.acessobd;

import CriarBD.Frame;
import CriarBD.ManageFilesReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author Pauroenriki
 */
public class AcessoMySql {
    
    
    
    Connection con;
    PreparedStatement pstm;
    ResultSet rs;
    
    
    
    
    
    
    public AcessoMySql(){ 
        
      
        
    }
    
    
    
    
    
    
    
    
    
    
    public Connection conectar(){
        
        
        try{
            
      
            
            
            Class.forName("com.mysql.jdbc.Driver");
            //con = DriverManager.getConnection("jdbc:mysql://adsreis.no-ip.biz/siscompetente?user=root&password=pauro8022");
            con = DriverManager.getConnection("jdbc:mysql://localhost:3306/siscompetente?user=root&password=adsreis");
        } catch (ClassNotFoundException ex){
            ex.printStackTrace();
            System.out.println("Não foi possível encontrar o Driver");            
        } catch (SQLException ex){
            ex.printStackTrace();
            System.out.println("Não foi possível conectar ao Banco de Dados");
        }
        return con;        
    }
    
    public void desconectar(){
        try{
            con.close();            
        } catch (SQLException ex){
            ex.printStackTrace();
        }
    }
    
    
 
    
}
    
    
    

